package main

import (
	"dlib/dbus"
	"time"
)

type TestSignal struct {
	TestInt   int32
	TestMap   map[string]string
	SignalMap func(map[string]string)
	NewSignal func(int32, string, bool)
}

func (test *TestSignal) GetDBusInfo() dbus.DBusInfo {
	return dbus.DBusInfo{
		"com.deepin.daemon.TestSignal",
		"/com/deepin/daemon/TestSignal",
		"com.deepin.daemon.TestSignal",
	}
}

func (test *TestSignal) TestTest(path dbus.ObjectPath) []string {
	strs := []string{}
	strs = append(strs, "hello")
	strs = append(strs, "world")
	return strs
}

func main() {
	test := TestSignal{}

	dbus.InstallOnSession(&test)

	for {
		m := make(map[string]string)
		m["hello"] = "world"
		test.SignalMap(m)
		timer := time.NewTimer(time.Second * 2)
		<-timer.C
		test.NewSignal(5, "Test", true)
	}
}
